﻿@model WebApplication.Models.ReportParameter


<script src="../../../Scripts/jquery-1.7.1.js"></script>
<script src="../../../Scripts/jquery-ui-1.8.20.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

<script type="text/javascript">

    $(document).ready(function () {

        $('#modalApplications').dialog({
            autoOpen: false,
            height: 345,
            width: 330,
            show: { effect: "toggle", duration: 800 },
            buttons: {
                "Применить": function () {
                    $('#applicationChoose').html('');
                    $('#applicationChoose').removeClass("alert-info").addClass("alert-success");
                    $("input#appChk:checked").each(function () {
                        var id = $(this).attr('idNot');
                        var name = $(this).attr('nameNot');

                        $('#applicationChoose').append('<input type="hidden" name="@Model.Name" value="' + id + '" />');

                        $('#applicationChoose').append('<div>Выбрано приложение: ' + name + '</div>');

                    });
                    //$(this).dialog('close');
                }
            },
            zIndex: 100000
        });

    })

    function chooseApp(e) {
        $('#modalApplications').html('');

        $.ajax({
            url: "/ServerObject/GetAllNotDeleted",
            type: "GET",
            success: function (data) {
                $('#modalApplications').html(data);
            }
        })
        $('#modalApplications').dialog('open');
    }

</script>

<div class="well">
    <div id="applicationChoose" class="alert alert-info">
        Ничего не выбрано
    </div>
    <input type="button" class="btn btn-primary btn-small" onclick="chooseApp(event);" value="Выбрать приложение" id="btnApplicationChoose" />
</div>

<div id="modalApplications" title="Выбор приложения">

</div>